﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HeadFirstDesignPatterns
{
    class CurrentConditionDisplay : IDisplayElement,IObserver
    {
        private float temperature;
        private float humidity;
        private ISubject weatherData;

        public CurrentConditionDisplay(ISubject weatherData) {
            this.weatherData = weatherData;
            this.weatherData.RegisterObserver(this);
        }

        public void Display() {
           Console.WriteLine("Current Condition :" + temperature +" F Degrees and " + humidity + "% humidity");

        }

        public void Update(float temp, float humidity, float pressure) {
            this.temperature = temp;
            this.humidity = humidity;
            Display();
        }
    }
}
